Repository navigation
Snowflake: Accept wildcard REPLACE and RENAME in either order - #2896
Open
ksaiharshavinay wants to merge 2 commits into
Open
ksaiharshavinay wants to merge 2 commits into
ksaiharshavinay wants to merge 2 commits into
Conversation
LucaCappelletti94
requested changes
Nov 9, 2026
LucaCappelletti94
left a comment
Contributor
There was a problem hiding this comment.
Please reduce the code comment verbosity, and make sure they neither describe the PR change nor what the code obviously does. Do not make further use LLMs to write the PR post or I will just close them. Just use your own words.
parse_wildcard_additional_options parsed the wildcard options in a single fixed-order pass, so SELECT * RENAME (...) REPLACE (...) failed with "Expected: end of statement, found: REPLACE". Parse REPLACE and RENAME in a loop so either order is accepted; a repeated option is still rejected. Co-Authored-By: Muse Spark <noreply@example.com> Signed-off-by: Sai Harsha Vinay Kudikala <ksaiharshavinay@users.noreply.github.com>
ksaiharshavinay
force-pushed
the
fix/wildcard-options-any-order
branch
from
November 9, 2026 17:11
c2329a0 to
af661ad
Compare
LucaCappelletti94
requested changes
Nov 11, 2026
| ) | ||
| .unwrap_err() | ||
| .to_string(), | ||
| "sql parser error: Expected: end of statement, found: REPLACE" |
Contributor
There was a problem hiding this comment.
Use the typed error here instead to to_string.
Signed-off-by: Sai Harsha Vinay Kudikala <ksaiharshavinay@users.noreply.github.com> Co-Authored-By: Muse Spark <noreply@example.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dialects: Snowflake, DuckDB
Fixes #2895.
SELECT * RENAME (a AS b) REPLACE (a + 1 AS a) FROM tfailed withExpected: end of statement, found: REPLACE. Snowflake allows the two options in either order: https://docs.snowflake.com/en/sql-reference/sql/select — I ran into this while working on wildcard support in OpenLineage.The parser read REPLACE first and then RENAME, in a fixed order. It now loops over the two, so either order parses and each option can still appear only once. The AST still prints in the REPLACE-first order.
Tests: a new test checks both orders produce the same AST, plus the repeated-option error case.
Disclosure: I used AI assistance (Claude) while preparing this PR.